package com.xzh.wms.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.xzh.wms.entity.*;
import com.xzh.wms.service.CategoryService;

import java.util.List;

/**
 * 商品分类;(206_category)控制层
 * @author : heimi
 * @date : 2024-11-19
 */
@RestController
@RequestMapping("/api/category")
public class CategoryController{
    @Autowired
    private CategoryService categoryService;
    
    /** 
     * 查询接口
     */
     @GetMapping
     public List<Category> select(CategoryQuery query){
        return categoryService.select(query);
    }
    
    @PostMapping 
    public Integer insert(@RequestBody Category product){
       return categoryService.insert(product);
    }
    
    @PutMapping 
    public Integer update(@RequestBody Category product){
        return categoryService.update(product);
    }
    
    @DeleteMapping
    public Integer delete(Integer id){
        return categoryService.delete(id);
    }
}